<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <style>
    	a{
    		color:#fff;
    	}
    </style>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <div class="easyui-layout" fit="true">
		<!-- 表格上的toolbar工具条 -->
		<div id="easyui_toolbar" region="north" border="true" style="border-bottom:1px solid #999;height:32px;">
			<div style="height:5px; width:100%;"></div>
			<div style="height:10px;width:620px;float:left;"></div>
        	<input class="easyui-searchbox" data-options="prompt:'请输入查询条件...',menu:'#mm',searcher:searchCust" style="width:300px"></input>
			<div id="mm">
				<div data-options="name:'mohu',iconCls:'icon-ok'">管理员名称模糊查找</div>
				<div data-options="name:'jingque'">管理员账号精确查找</div>
			</div>
        	
		</div>
		<!-- 表格数据区域 -->
		
		<div region="center" border="false" data-optinos:"fit:true;" style="">
			<table id="admintable">
			
			</table>
		</div>
	</div>
	<script>
		function searchCust(value,name){
			$("#admintable").edatagrid({
				url:'backadmin/admin.action?op=findAllAdmins',
				saveUrl:'backadmin/admin.action?op=saveAdmin',
				updateUrl:'backadmin/admin.action?op=editAdmin',
				idField:"uid",
				pagination:true,
				pageNumber:1,
				pageSize:10,
				pageList:[10,20,120,40,50],
				fit:true,
				fitColumns:true,
				rownumbers:true,
				singleSelect:true,//表示可以单行选择
				title:"客户信息列表",
				sortName:"uid",
				sortOrder:"asc",
				queryParams: {
					searchOptions:value,
					seacherType:name
				},
				columns:[[  
				          {field:'aid',title:'管理员编号',width:120,align:'center'}, 
				          {field:'aname',title:'管理员账号',width:120,align:'center',editor:'text'},
				          {field:'apwd',title:'密码',editor:'text',width:120,align:'center',
				        		formatter:function(){
				        			return "**********";
				        		}  
				          },  
				          {field:'astatus',title:'状态',width:120,align:'center',
				        	  formatter: function(value,row,index){
					  				if(value==0){
					  					return "离线";
					  				}else if(value==1){
					  					return "在线";
					  				}else if (value==2){
					  					return "失效";
					  				}
					  			},
				          },
				]],
				toolbar:[
					{
						text:"添加",
						iconCls:'icon-add',
						handler:function(){
							$("#admintable").edatagrid("addRow");//isnewrecode
						}
					},
					{
						text:"保存",
						iconCls:'icon-add',
						handler:function(){
							//在这里执行密码提交以前的比较工作
							
							$("#admintable").edatagrid("saveRow");//完成添加或者更新
						}
					},
					{
						text:"撤销操作",
						iconCls:'icon-undo',
						handler:function(){
							$("#admintable").edatagrid("cancelRow");
						}
					}
				]
		
			});
		}
		$(function(){
			searchCust("","");
		});
	</script>
  </body>
</html>
